/*
 * 2.1.cpp
 *
 *  Created on: 2012-5-16
 *      Author: jawinton
 */


#include <iostream>

using namespace std;

int main (void) {
	int a, n;
	cin >> n;
	while (n--) {
		cin >> a;
		if ( (a%2) == 0) {
			if ((a%4) == 0) {
				cout << a/4 << " " << a/2 << endl;
			} else {
				cout << a/4 + 1 << " " << a/2 << endl;
			}
		} else {
			cout << "0 0" << endl;
		}
	}
	return 0;
}
